<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>aurora-Web</title>
	<%@ include file="/common/meta.jsp" %>

	<script src="${ctx}/js/jquery-1.6.1.min.js" type="text/javascript"></script>
	<script src="${ctx}/js/jmesa/jquery.jmesa.min.js" type="text/javascript"></script>
	<script src="${ctx}/js/jmesa/jmesa.min.js" type="text/javascript"></script>
	<link href="${ctx}/js/jmesa/jmesa.css" type="text/css" rel="stylesheet"/>
	


</head>

<body>
	
    <div id="table1" style="float:left;">  

    </div>  
	
    <div id="table1" style="float:left;width:2px">  

    </div>  
    <div id="table2" style="float:left;">
    
    </div>
    
 
<script type="text/javascript">
  
    $(window).load(function() {
      $.get('${ctx}/service/bill/billTable?filter_EQS_sysFlag=1', function(data) {
        $("#table1").html(data);
        $("#billTable_row1").click();
        $("#billTable_row1").attr("checked",true);
        
      });
    });
                    
    function onInvokeAction(id, action) {
        $.jmesa.setExportToLimit(id, '');
        var parameterString = $.jmesa.createParameterStringForLimit(id);
        if (tableId='billTable'){
	        $.get('${ctx}/service/bill/billTable?'+parameterString+'&filter_EQS_sysFlag=1', function(data) {
	          $("#table1").html(data);
	          $("#billTable_row1").click();
	        });  
      	}else if (tableId='billDetailTable'){
	        $.get('${ctx}/service/bill/billDetailTable?'+parameterString+'&filter_EQS_sysFlag=1', function(data) {
	          $("#table2").html(data);
	        });  
      	}       
    }
    function onInvokeExportAction(id) {
        var parameterString = $.jmesa.createParameterStringForLimit(id);
        location.href = '${ctx}/service/bill/index?' + parameterString;
    }
    
    function onClickAction(tableId,rowIndex,billId) {
			$("input[name='"+tableId+"_checkbox']").removeAttr("checked");
			$("#"+tableId+"_checkbox"+rowIndex).attr("checked",true);
			if (tableId='billTable'){
				$.get('${ctx}/service/bill/billDetailTable?filter_EQS_sysFlag=1&id='+billId, function(data) {
	        $("#table2").html(data)
	      });
    	}
    }
    
    function onAddAction(tableId,billId) {
    	$("#table1").hide();
    	$("#table2").hide();
    }
    
    function onDeleteAction(tableId,billId) {
        var parameterString = $.jmesa.createParameterStringForLimit(tableId);
        $.ajax({
            url: '${ctx}/service/bill/'+billId,
            type: 'DELETE',
            error: function(data){
                alert('Error loading document');
            },
            success: function(data){
              
				      $.get('${ctx}/service/bill/billTable?filter_EQS_sysFlag=1', function(data) {
				        $("#table1").html(data);
				        $("#billTable_row1").click();
				        $("#billTable_row1").attr("checked",true);
				        
				      });
            }
        });
    }
</script>

</body>
</html>
